<script>
export default { name: 'Activity' };
</script>

<script setup>
import { ref } from 'vue'
import Banner from '@/components/Banner.vue'
import oac_soma from '@/assets/img/activity/oac_soma.png'
import meetup from '@/assets/img/activity/meetup.png'
import yunxi from '@/assets/img/activity/yunxi.png'

const activityList = ref([
  {
    title: '议程剧透！产学研专家齐聚北京，共话 AI 驱动的智能化运维和可观测 | 2023龙蜥操作系统大会',
    time: '2023.12.18 13:30-17:10',
    address: '北京嘉瑞文化中心 1F 视界厅1',
    status: 1, // 0 已结束  1 报名中
    online: false,
    image: oac_soma,
    url: 'https://mp.weixin.qq.com/s/gVBaOj4Oi6s5NY7kkvRHMg',
  },
  {
    title: '龙蜥社区系统运维MeetUp！云场景下运维的核心痛点及解决方案研讨',
    time: '2023/08/12 13:30-18:00',
    address: '杭州奥克斯皇冠假日酒店',
    status: 0,
    online: false,
    image: meetup,
    url: 'https://openanolis.cn/video/906017274409515702',
  },
  {
    title: '报名中！阿里云、统信软件、西安邮电等多位专家教授畅谈eBPF和Linux的硬核技能',
    time: '2022/11/03 14:00 ~ 2022/11/03 18:00',
    address: '杭州云栖小镇国际会展中心D区',
    status: 0,
    online: false,
    image: yunxi,
    url: 'https://openanolis.cn/activity/679927114451229677',
  },
])
</script>

<template>
  <div class="activity-wrap">
    <div class="container">
      <Banner>
        <template v-slot:bg>
          <img class="banner-bg" src="@/assets/img/activity/banner_bg.png" />
        </template>
      </Banner>

      <div class="content-item">
        <div class="content-item-title">联盟最新动态</div>
        <div class="activity-list">
          <a
            v-for="(item, index) in activityList"
            :key="index"
            :href="item.url"
            target="_blank"
            class="activity-item">
            <div class="activity-img-wrap">
              <img class="activity-img" :src="item.image" :alt="item.title" />
              <div :class="['activity-status', { end: item.status === 0 }]">
                <span>{{ item.status === 0 ? '已结束' : '报名中' }}</span>
              </div>
            </div>

            <div class="activity-cont">
              <div class="activity-title">
                <span class="online">{{ item.online ? '线上' : '线下' }}</span>
                {{ item.title }}
              </div>
              <div class="activity-address">活动地址：{{ item.address }}</div>
              <div class="activity-time">活动时间：{{ item.time }}</div>
            </div>
          </a>
        </div>
      </div>
    </div>
  </div>
</template>

<style lang="scss" scoped>
.activity-wrap {
  background: #F9F9F9;

  .container {
    margin: 0 auto;
    padding: 20px 0;
    width: 1180px;
  }

  .content-item {
    margin-top: 38px;

    .content-item-title {
      padding-left: 12px;
      font-family: PingFangSC-Regular;
      font-size: 24px;
      line-height: 36px;
      color: #333333;
      letter-spacing: 0;
      font-weight: 400;
      position: relative;
      &::before {
        content: '';
        width: 4px;
        height: 24px;
        background: #0F75E8;
        transform: translate(0, -50%);
        position: absolute;
        left: 0;
        top: 50%;
      }
    }
  }

  .activity-list {
    padding-top: 14px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .activity-item {
    margin-bottom: 20px;
    display: block;
    width: calc((100% - 40px) / 3);
    background: #FFFFFF;
    border-radius: 4px;
    overflow: hidden;
    font-family: PingFangSC-Regular;
    font-size: 14px;
    color: #757575;
    line-height: 24px;
    font-weight: 400;

    .activity-img-wrap {
      height: 214px;
      display: flex;
      align-items: center;
      justify-content: center;
      overflow: hidden;
      position: relative;

      .activity-img {
        max-width: 100%;
        max-height: 100%;
      }

      .activity-status {
        width: 100%;
        height: 40px;
        padding: 0 20px;
        line-height: 40px;
        background-color: rgba(16,117,231,.9);
        font-size: 16px;
        color: #FFFFFF;
        position: absolute;
        left: 0;
        bottom: 0;
        &.end {
          background-color: rgba(46,65,87,.61);
        }
      }
    }

    .activity-cont {
      padding: 16px 20px;
    }

    .activity-title {
      font-family: PingFangSC-Medium;
      font-size: 18px;
      color: #262626;
      line-height: 25px;
      font-weight: 500;
      display: -webkit-box;
      -webkit-box-orient: vertical;
      -webkit-line-clamp: 2;
      word-break: break-all;
      overflow: hidden;
    }

    .online {
      margin: -2px 5px 0 0;
      display: inline-flex;
      vertical-align: middle;
      padding: 0 6px;
      border: 1px solid #0F75E8;
      border-radius: 3px;
      color: #0F75E8;
      font-size: 12px;
      line-height: 18px;
    }

    .activity-address,
    .activity-time {
      margin-top: 6px;
      line-height: 18px;
      text-overflow: ellipsis;
      white-space: nowrap;
      overflow: hidden;
    }
  }
}
</style>
